package com.example.fish;

import com.example.fish.utils.JsonResult;
import lombok.AllArgsConstructor;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Learn {
    @AllArgsConstructor
    private class Cat{
        private String name;
        private String age;
    }
    public static void main(String[] args) {
        System.out.println(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
        System.out.println("-------------------------------------------");
        String object = "hello";
        Integer t= null;
        int t1 = 1;

        Map<String,Integer> map = new HashMap<>();
        map.put("1",1);
        map.put("2",2);
        System.out.println(map.size());
        System.out.println(map.get("1"));
        map.forEach((k,v)->{
            System.out.println(k+"---"+v);
        });
        System.out.println("entrySet:"+map.entrySet());

        List<String> names = new ArrayList<>();
        names.add("jack");
        names.add("tom");
        for (String name : names) {
            System.out.println(name);
        }

        Class<?> classes = Cat.class;

        System.out.println("-------------------------------------------");
        System.out.println(new MessageTestBox<>(200, "测试成功", map));
        System.out.println(new JsonResult<>(200,"测试成功",map));
        System.out.println("-------------------------------------------");
        System.out.println(new MessageTestBox<>("测试不带code", object));

        String resv= "hello resverse";
        StringBuilder stringBuilder = new StringBuilder(resv);
        StringBuilder reverse = stringBuilder.reverse();
        System.out.println("----------------------------------");
        System.out.println(reverse.toString());


    }
    @RequestMapping("/test")
    public class TestController{
        @GetMapping("/home")
        private MessageTestBox<Map<String,Integer>> box(){
            return new MessageTestBox<>(200, "测试成功",new HashMap<>());
        }
    }
}
